﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace NLBS.Web.UI
{
   public class PluginCommand:ICommand
    {
        private string controlName;
        private string param;

        public PluginCommand(string param, string[] controlName)
        {
            this.param = param;
            if(controlName.Length>1)
            this.controlName = controlName[1];
            
        }
        #region ICommand Members

        public void Excute()
        {
            IPlugin plugin = (IPlugin)ViewManager.LoadControl("/Plugins/"+controlName+"/"+controlName+".ascx");
            switch (param)
            {
                case "Install":
                    plugin.Install();
                    break;
                case "UnInstall":
                    plugin.UnInstall();
                    break;
            }

        }

        #endregion
    }
}
